var t = getApp();

Page({
    data: {
        codetext: "获取短信验证码",
        imgcode: "",
        payer_phone: "",
        card_id: "",
        start1: !1
    },
    onLoad: function(t) {
        this.getInfo(), this.setData({
            card_id: t.card_id
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    numInp: function(t) {
        var n = t.detail.value;
        this.setData({
            sms_code: n
        });
    },
    sendCode: function(t) {
        if (this.data.start1) return !1;
        var n = 60, o = this;
        o.setData({
            start1: !0,
            codetext: "(" + n + ")秒后重新获取"
        });
        var e = setInterval(function() {
            o.setData({
                codetext: "(" + --n + ")秒后重新获取"
            });
        }, 1e3);
        setTimeout(function() {
            o.setData({
                codetext: "获取短信验证码",
                start1: !1
            }), clearInterval(e);
        }, 6e4), o.verificationCode(e);
    },
    verificationCode: function(n) {
        var o = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.bind-card");
        t._getNetWork({
            url: o,
            data: {
                card_id: this.data.card_id
            },
            success: function(t) {
                var n = t.data;
                1 == n.result ? wx.showToast({
                    icon: "none",
                    title: "已发送",
                    duration: 1500
                }) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    confirm: function() {
        var n = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.confirm-bind-card");
        t._getNetWork({
            url: n,
            data: {
                card_id: this.data.card_id,
                sms_code: this.data.sms_code
            },
            showToastIn: !1,
            success: function(t) {
                var n = t.data;
                1 == n.result ? (wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                }), wx.navigateTo({
                    url: "/packageD/quickPay/member_choose_bank/member_choose_bank"
                })) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getInfo: function() {
        var n = this, o = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-payer-info");
        t._getNetWork({
            url: o,
            showToastIn: !1,
            success: function(t) {
                var o = t.data;
                1 == o.result ? n.setData({
                    payer_phone: o.data.payer_phone
                }) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    }
});